<?php

Zend_Loader::loadClass('Lead_Tool_File_Searcher');
Zend_Loader::loadClass('Lead_EDO_Exception');
Zend_Loader::loadClass('Lead_EDO_Object_Abstract');


/**
 * @category Lead
 * @package Lead_EDO
 * 
 *
 */
class Lead_EDO
{
	/**
	 * Creates a new EDO handler.
	 *
	 * @param LDB_base $ldbObj
	 * @return Lead_EDO_Handler_Functional
	 */
	public static function factory(Zend_DB_Adapter_Abstract $db, $cacheBackend = null)
	{
		Zend_Loader::loadClass('Lead_EDO_Handler_Functional');
		$handler = new LEAD_EDO_Handler_Functional($db);

        if($cacheBackend) {
            $handler->setCache(true);
            $backend = 'Zend_Cache_Backend_' . $cacheBackend['backend'];
            Zend_Loader::loadClass($backend);
            $cache = new $backend($cacheBackend['backendOptions']);
            $handler->setCacheBackend($cache);
        } else {
            $handler->setcache(false);
        }
		return $handler;
	}
}
?>